package com.control.qct.businesssteward.adapter;

import android.graphics.Color;
import android.text.TextUtils;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.control.qct.businesssteward.R;
import com.control.qct.businesssteward.model.GoodsStatisticModel;
import com.control.qct.businesssteward.model.TypeStatisticModel;
import com.control.qct.businesssteward.utils.DecimalFormatUtils;

/**
 * Created by Administrator on 2017/12/26 0026.
 */

public class GoodsStatisticAdapter extends BaseQuickAdapter<GoodsStatisticModel, BaseViewHolder> {
    public GoodsStatisticAdapter() {
        super(R.layout.rv_statistical_table_item);
    }

    @Override
    protected void convert(BaseViewHolder holder, GoodsStatisticModel item) {
        holder.setTextColor(R.id.tv_type_name, item.getTitle().equals("合计") ? Color.parseColor("#333333") : Color
                .parseColor("#05C2A9")).setTextColor(R.id.tv_sell_price, item.getTitle().equals("合计") ? Color
                .parseColor("#333333") : Color.parseColor("#797979")).setTextColor(R.id.tv_gross_margin, item
                .getTitle().equals("合计") ? Color.parseColor("#333333") : Color.parseColor("#797979")).setTextColor(R
                .id.tv_sale_proportion, item.getTitle().equals("合计") ? Color.parseColor("#333333") : Color
                .parseColor("#797979")).setText(R.id.tv_type_name, item.getTitle()).setText(R.id.tv_sell_price,
                TextUtils.isEmpty(item.getBarcode())?"一":item.getBarcode()).setText(R.id.tv_gross_margin, item.getSaleNumber() + "").setText(R.id
                .tv_sale_proportion, DecimalFormatUtils.DecimalFormatTwo(item.getSaleTotal()));
    }

}
